package top.huxy.socketrequest.config;

import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.socket.server.standard.ServerEndpointExporter;
import top.huxy.socketrequest.core.SocketRequestServer;

/**
 * @author aproz
 * @Date 2022/5/17
 */
@Configuration
@Slf4j
@ConditionalOnBean(SocketRequestServer.class)
public class SocketRequestAutoConfig {
    public SocketRequestAutoConfig() {
        log.info("加载SocketRequest服务");
    }

    @Bean
    @ConditionalOnMissingBean(ServerEndpointExporter.class)
    public ServerEndpointExporter getServerEndpointExporter() {
        return new ServerEndpointExporter();
    }
}
